Skip to content

ci: cache SonarScanner CLI to avoid flaky CDN download - #1874

Closed
firecow wants to merge 2 commits into
masterfrom
fix/cache-sonar-scanner-cli
Closed

ci: cache SonarScanner CLI to avoid flaky CDN download#1874
firecow wants to merge 2 commits into
masterfrom
fix/cache-sonar-scanner-cli

Conversation

@firecow

@firecow firecow commented Jun 4, 2026

Copy link
Copy Markdown
Owner

The SonarQube scan action downloads the scanner CLI from binaries.sonarsource.com on every run, which intermittently returns HTTP 403 and fails the master build even though tests pass (a known SonarSource CDN issue).

The action checks the GitHub Actions tool-cache first (tc.find) and only downloads on a miss, so persisting that directory with actions/cache makes every run after the first restore the scanner and skip the CDN entirely — the scan still runs, nothing is suppressed. scannerVersion is pinned so the cache key invalidates on a version bump.

Residual: a cold cache (first run / scanner version bump) still hits the CDN once; if that transiently 403s, a single re-run seeds the cache permanently.

Test plan

  • YAML parses; continue-on-error not used; cache key matches pinned scannerVersion

Summary by cubic

Cache the SonarScanner CLI in CI to avoid intermittent CDN 403s and keep builds stable. Restores the scanner from actions/cache and pins scannerVersion: 8.1.0.6389, so after the first run the CDN is skipped; the cache is only used when SONAR_TOKEN is set.

Written for commit 637a89a. Summary will update on new commits.

Review in cubic

firecow added 2 commits June 4, 2026 08:29
The SonarQube scan runs as the final step of the test job and intermittently
returns HTTP 403 while downloading the scanner CLI from binaries.sonarsource.com,
failing the whole build even though tests passed. It is a reporting step and the
quality gate is reported via its own check, so mark it continue-on-error.
The scan action downloads the scanner CLI from binaries.sonarsource.com on
every run, which intermittently returns HTTP 403 and fails the build. The
action checks the tool-cache first (tc.find) and only downloads on a miss, so
persisting that directory with actions/cache makes every run after the first
restore the scanner and skip the CDN entirely. scannerVersion is pinned to keep
the cache key in sync.
@firecow firecow self-assigned this Jun 4, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

@firecow firecow closed this Jun 4, 2026
@firecow
firecow deleted the fix/cache-sonar-scanner-cli branch June 4, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant